home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6062 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: converting strings to ints??
  5. Date: Sun, 11 Feb 1996 14:09:35 GMT
  6. Organization: Netcom
  7. Message-ID: <311df758.156507255@nntp.ix.netcom.com>
  8. References: <4fk223$s6k@newsbf02.news.aol.com> <marnoldDMLyuM.9Io@netcom.com>
  9. NNTP-Posting-Host: ix-dc12-11.ix.netcom.com
  10. X-NETCOM-Date: Sun Feb 11  6:09:05 AM PST 1996
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. marnold@netcom.com (Matt Arnold) wrote:
  14.  
  15. > possum4456@aol.com (Possum4456) writes:
  16. > >Is there a function, I heard it was in stdio.h, that converts a string of
  17. > >numbers to integers so they can be added or whatever?:-)
  18. >     atoi()   // name comes from "ANSI to integer"
  19. > Don't you have any documentation with your compiler or at least a good 
  20. > "C" book?  This is basic stuff.  This wasn't even a C++ question.  Try 
  21. > comp.lang.c next time.
  22.  
  23. Why is this not a C++ question?  atoi() is part of the C++ language.
  24. The fact that it is also part of another language doesn't make it
  25. unsuitable for discussion here.
  26.  
  27. Of course, atoi() should be documented, but many compilers document
  28. such things in ways that are difficult for a beginner to find.  I've
  29. seen several that simply list functions in alphabetic order --
  30. certainly not the best for finding a function knowing the task it is
  31. to do.
  32.  
  33. It's also probably worth noting that strtol() is often a better choice
  34. than atoi() since it gives help in error checking.
  35.  
  36.  
  37. Michael M Rubenstein
  38.